﻿namespace Sai.Test.Introspection
{
    using Sai.Core;
    using Sai.Test.TestDataBuilders;
    using Sai.Test.XUnit;
    using Xunit;

	public class FieldDeclarationFacts
	{
		public class TheToCodeMethod
		{
            
            [Fact, InMemoryTest]
            public void Returns_Type_And_Field_Name()
            {
                var field = FieldDeclarationBuilder.Field()
                    .Named("Amount")
                    .OfType("double")
                    .InClass("Calculator")
                    .Build();

                SourceCode code = field.ToCode();

                Assert.Equal(2, code.Content.Count);
                Assert.Equal("tn", code.Content[0].Name);
                Assert.Equal("double", code.Content[0].Value);
                Assert.Equal("ident", code.Content[1].Name);
                Assert.Equal("Amount", code.Content[1].Value);
            }
		}
	}
}
